#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main()
{
	int i = 0;
	int max = -1;
	int min = 1001;
	scanf("%d", &i);
	int x = 0;
	getchar();
	for (int t = 1;t <=i; t++)
	{
		scanf("%d",&x);
		if (x > max)
		{
			max = x;
		}
		else if (x < min)
		{
			min = x;
		}
	}
	int s = max - min;
	printf("%d", s);
	return 0;
}